<!DOCTYPE html>
<html lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
<title>二步验证 - {$xpConfig['web_name']}</title>
<link rel="shortcut icon" type="image/x-icon" href="{$xpConfig['web_static']}/favicon.ico">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<link rel="stylesheet" type="text/css" href="{$xpConfig['web_static']}/css/materialdesignicons.min.css">
<link rel="stylesheet" type="text/css" href="{$xpConfig['web_static']}/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="{$xpConfig['web_static']}/css/animate.min.css">
<link rel="stylesheet" type="text/css" href="{$xpConfig['web_static']}/css/style.min.css">
<style>
.check-form .has-feedback {
    position: relative;
}
.check-form .has-feedback .form-control {
    padding-left: 36px;
}
.check-form .has-feedback .mdi {
    position: absolute;
    top: 0;
    left: 0;
    right: auto;
    width: 36px;
    height: 36px;
    line-height: 36px;
    z-index: 4;
    color: #dcdcdc;
    display: block;
    text-align: center;
    pointer-events: none;
}
</style>
</head>

<body class="center-vh" style="background-image: url({$xpConfig['web_static']}/images/login-bg-3.jpg); background-size: cover;">
<div class="bg-translucent p-2">
  <div class="flex-box bg-white login-box">
    <div class="login-left p-5">
      
      <form action="{:url('admin/index/lock')}" method="post" class="check-form needs-validation" novalidate>
    
        <div class="mb-3 has-feedback">
          <span class="mdi mdi-lock" aria-hidden="true"></span>
          <input type="password" class="form-control" id="code" autocomplete="off" name="code" placeholder="输入6位验证码" required>
        </div>
    
        <div class="mb-3 d-grid">
          <button class="btn btn-primary" type="submit">立即解锁</button>
        </div>
      </form>
    </div>
  </div>
</div>

<script type="text/javascript" src="{$xpConfig['web_static']}/js/jquery.min.js"></script>
<script type="text/javascript" src="{$xpConfig['web_static']}/js/popper.min.js"></script>
<script type="text/javascript" src="{$xpConfig['web_static']}/js/bootstrap.min.js"></script>
<script type="text/javascript" src="{$xpConfig['web_static']}/js/bootstrap-notify.min.js"></script>
<script type="text/javascript" src="{$xpConfig['web_static']}/js/lyear-loading.js"></script>
<script type="text/javascript" src="{$xpConfig['web_static']}/js/layer/layer.js"></script>
<script type="text/javascript">
var loader;
$(document).ajaxStart(function(){
    $("button:submit").html('解锁中...').attr("disabled", true);
    loader = $('button:submit').lyearloading({
        opacity: 0.2,
        spinnerSize: 'nm'
    });
}).ajaxStop(function(){
    loader.destroy();
    $("button:submit").html('立即解锁').attr("disabled", false);
});
$('.check-form').on('submit', function(event) {
    if ($(this)[0].checkValidity() === false) {
        event.preventDefault();
        event.stopPropagation();
        $(this).addClass('was-validated');
        return false;
    }
    
    var $data  = $(this).serialize();
    $.post($(this).attr('action'), $data, function(res) {
        if (res.code) {
          layer.alert('解锁成功', { icon: 'success' }, function (){
            location.href = "{:url('admin/dashboard/index')}";
          });
        } else {
            layer.alert(res.msg, { icon: 'error' });
            $('#code').val('');
        }
    }).fail(function () {
        layer.alert('服务器错误', { icon: 'error' });
    });
    return false;
});
</script>
</body>
</html>